{  Statement: http://acmp.ru/?main=task&id_task=12
   Verdict: Accepted
}
uses
    SysUtils, Math;

const
    MAXN = 4;

type
    pt = record
        x, y : int64;
    end;
    
var
    i, n, ans : longint;
    p : array[1..MAXN] of pt;
    pp : pt;

function vect(x1, y1, x2, y2 : int64) : int64;
begin
    result := x1 * y2 - x2 * y1;
end;

function check(x : longint) : boolean;

var
    c, t : pt;

begin
    if x = MAXN then c := p[1] else c := p[x + 1];
    if x = MAXN then t := p[2] else 
    if x = MAXN - 1 then t := p[1] else t := p[MAXN];
    result := vect(pp.x - p[x].x, pp.y - p[x].y, c.x - p[x].x, c.y - p[x].y) * vect(t.x - p[x].x, t.y - p[x].y, c.x - p[x].x, c.y - p[x].y) >= 0;
end;

begin
    reset(input,'input.txt');
    rewrite(output,'output.txt');
    read(n);
    ans := 0;
    for i := 1 to n do begin
        read(pp.x, pp.y, p[1].x, p[1].y, p[2].x, p[2].y, p[3].x, p[3].y, p[4].x, p[4].y);
        inc(ans, byte(check(1) and check(2) and check(3) and check(4)));
    end;
    write(ans);
end.
